// DataRequest.h
//
#ifndef __DATAREQUEST_H_
#define __DATAREQUEST_H_

#include "base/LineMask.h"
#include "base/MemoryRequest.h"

class LineFlags;

/// A MemoryRequest with data
class DataRequest : public MemoryRequest {
  public:
    NEW_DELETE_OPERATORS_H(DataRequest,MemoryRequest);
    DataRequest (VA addr,
                 Processor* p,
                 Entity* source,
                 Entity* dest,
                 uint dataSize,
                 uint headerSize);
    virtual ~DataRequest ();

    virtual void resetForRetry ();

    uint getDataSize () const;
    const char* getData () const;

    void insertData (const void* addr, uint size);
    void setWord (uint word);
    void setWord (uint word, uint index);
    void setByte (uint8 byte);
    void setByte (uint8 byte, uint index);

    bool isExclusive () const;
    void setExclusive (bool a);
    
    bool isUncached () const;
    void setUncached (bool a);

    bool isNonSpeculative() const;
    void setNonSpeculative(bool a);

    bool isFlushed () const;
    void setFlushed (bool a);

    void setFlags(LineFlags* _flags);
    LineFlags* getFlags() const;

    LineMask const& getMask () const;

    virtual char const* toString() const;

  protected:
    uint dataSize; ///< sizeof(data)
    char* data;
    bool exclusive; ///< if it is part of an atomic operation (ll/sc etc)
    bool uncached; ///< if true, caches should just pass this along
    bool nonSpeculative;
    bool flushed;
    LineFlags* flags;
    LineMask mask;
};

#endif // __DATAREQUEST_H__
